<html>

<head>
    <style type="text/css">
        table.gradienttable {
            font-family: verdana, arial, sans-serif;
            border-width: 3px;
            border-collapse: collapse;
            width: 100%;
        }
        
        table.gradienttable th {
            padding: 3px;
            color: #FFFFFF;
            background: #000066;
            font-size: 12px;
        }
        
        table.gradienttable td {
            padding: 3px;
            color: #000000;
            font-size: 11px;
            background: #ebecda;
            text-align: center;
        }
        
        table.gradienttable th p {
            margin: 3px;
            padding: 9px;
        }
        
        table.gradienttable td p {
            padding: 9px;
        }
    </style>
    <style>

    </style>

    <script>
        function openWeekSummary() {
            // 获取日期选择控件的值
            var date = document.getElementById('mydate').value;

            // 构建目标URL
            var url = '/task/weeksummary?date=' + encodeURIComponent(date);

            // 打开新窗口
            window.open(url, '_blank');
        }

        function refreshFeishu() {
            var selectedMan = document.querySelector('input[name="man"]:checked').value;
            var url = '/task/feishu?man=' + encodeURIComponent(selectedMan);
            window.location.href = url;
        }

        function refreshTapd() {
            var selectedMan = document.querySelector('input[name="man"]:checked').value;
            var url = '/task/tapdtask?man=' + encodeURIComponent(selectedMan);
            window.location.href = url;
        }


        
        function check() {
            // 获取日期选择控件的值
            var date = document.getElementById('mydate').value;

            // 构建目标URL
            var url = '/task/check?date=' + encodeURIComponent(date) + '&force=true';
            window.location.href = url;
        }


        function doquery(){
            
            var begin = document.getElementById('mybegindate').value;
            var end = document.getElementById('myenddate').value;

            // 构建目标URL
            var url = "/taskcount/home?begin=" + encodeURIComponent(begin) + "&end=" + encodeURIComponent(end) + "&man=#(man)&cust=#(cust)&isCust=#(isCust)"
            var params = [];
            for (var i = 1; i <= 10; i++) {
                var checkbox = document.querySelector('input[name="xStatus' + i + '"]');
                if (checkbox && checkbox.checked) {
                    params.push('status' + i + '=true');
                }
            }

            if (params.length > 0) {
                url += '&' + params.join('&');
            }
            window.location.href = url;
        }
    </script>
</head>

<body>
    <div style="width:1366px;margin-left:auto;margin-right:auto;">
		<h1 style="text-align:center;">
            #if(man??) #(man) - #end
            #if(cust??) #(cust) - #end
            统计 #date(begin, "yyyy年MM月dd日") - #date(end, "yyyy年MM月dd日")
        </h1>
        <table class="gradienttable" border="1" style="width:100%;line-height:2em;">
            <tr>
                <th>开发</th>
                <th>客户</th>
                <th style="width:8em;">未开始</th>
                <th style="width:8em;">已完成</th>
                <th style="width:8em;">进行中</th>
                <th style="width:8em;">其他</th>
                <th style="width:8em;">全部</th>
                <th style="width:8em;">总工时h</th>
                <th style="width:8em;">完成任务天数</th>
                <th style="width:8em;">最大工时</th>
                <th style="width:8em;">无工时任务</th>
            </tr>
            #for(d:countdatas)
                <tr>
                    <td><a href="/taskcount/home?man=#(d.xMan)&isCust=1&begin=#date(begin,'yyyy-MM-dd')&end=#date(end,'yyyy-MM-dd')" target="_blank">#(d.xMan)</a></td>
                    <td><a href="/taskcount/home?man=#(d.xMan)&cust=#(d.xCust)&isCust=1&begin=#date(begin,'yyyy-MM-dd')&end=#date(end,'yyyy-MM-dd')" target="_blank">#(d.xCust)</a></td>
                    <td>#(d.xStatus1)</td>
                    <td>#(d.xStatus2)</td>
                    <td>#(d.xStatus3)</td>
                    <td>#(d.xStatus4)</td>
                    <td>#(d.xStatus5)</td>
                    <td>#number(d.xTotalHour,"0.#")</td>
                    <td>#(d.xDayCnt)</td>
                    <td>#number(d.xMaxHour,"0.#")</td>
                    <td>#(d.xNullCnt)</td>
                </tr>
            #end
        </table>
    </div>
    

    

    #if(man??)
        

        <div style="width:100%;margin-left:auto;margin-right:auto;">
            #if(tops??)
                <h3 style="text-align: left;">耗时做多的任务TOP20</h3>
                <table class="gradienttable" border="1" style="width:100%;line-height:2em;">
                    <tr>
                        <th style="width:10em;">ID</th>
                        <th style="width:15em;">客户</th>
                        <th>任务</th>
                        <th style="width:10em;">标签</th>
                        <th style="width:10em;">优先级</th>
                        <th style="width:10em;">创建日期</th>
                        <th style="width:10em;">完成日期</th>
                        <th style="width:10em;">工时</th>
                    </tr>
                    #for(s:tops)
                        <tr>
                            <td><a href="https://www.tapd.cn/#(s.rWorkspace_ID)/prong/task/view/#(s.sID)" target="_blank">#(s.xShortID)</a></td>
                            <td>#(s._Cust_Name)</td>
                            <td><a href="https://www.tapd.cn/#(s.rWorkspace_ID)/prong/task/view/#(s.sID)" target="_blank">#(s.xName)</a></td>
                            <td>#(s.xLabel)</td>
                            <td>#(s.xPriority)</td>
                            <td>#date(s.sCreateDate, "yyyy-MM-dd")</td>
                            <td>#date(s.xFinishTime, "yyyy-MM-dd")</td>
                            <td>#number(s.xHour, "0.#")</td>
                        </tr>
                    #end
                </table>
            #end
        </div>

        

        <div style="width:100%;margin-left:auto;margin-right:auto;">
            #if(taskdata1??)
                <h3 style="text-align: left;">未开始</h3>
                <table class="gradienttable" border="1" style="width:100%;line-height:2em;">
                    <tr>
                        <th style="width:10em;">ID</th>
                        <th style="width:15em;">客户</th>
                        <th>任务</th>
                        <th style="width:10em;">标签</th>
                        <th style="width:10em;">优先级</th>
                        <th style="width:10em;">创建日期</th>
                        <th style="width:10em;">完成日期</th>
                        <th style="width:10em;">工时</th>
                    </tr>
                    #for(s:taskdata1)
                        <tr>
                            <td><a href="https://www.tapd.cn/#(s.rWorkspace_ID)/prong/task/view/#(s.sID)" target="_blank">#(s.xShortID)</a></td>
                            <td>#(s._Cust_Name)</td>
                            <td><a href="https://www.tapd.cn/#(s.rWorkspace_ID)/prong/task/view/#(s.sID)" target="_blank">#(s.xName)</a></td>
                            <td>#(s.xLabel)</td>
                            <td>#(s.xPriority)</td>
                            <td>#date(s.sCreateDate, "yyyy-MM-dd")</td>
                            <td>#date(s.xFinishTime, "yyyy-MM-dd")</td>
                            <td>#number(s.xHour, "0.#")</td>
                        </tr>
                    #end
                </table>
            #end
        </div>

        
        <div style="width:100%;margin-left:auto;margin-right:auto;">
            #if(taskdata2??)
                <h3 style="text-align: left;">已完成</h3>
                <table class="gradienttable" border="1" style="width:100%;line-height:2em;">
                    <tr>
                        <th style="width:10em;">ID</th>
                        <th style="width:15em;">客户</th>
                        <th>任务</th>
                        <th style="width:10em;">标签</th>
                        <th style="width:10em;">优先级</th>
                        <th style="width:10em;">创建日期</th>
                        <th style="width:10em;">完成日期</th>
                        <th style="width:10em;">工时</th>
                    </tr>
                    #for(s:taskdata2)
                        <tr>
                            <td><a href="https://www.tapd.cn/#(s.rWorkspace_ID)/prong/task/view/#(s.sID)" target="_blank">#(s.xShortID)</a></td>
                            <td>#(s._Cust_Name)</td>
                            <td><a href="https://www.tapd.cn/#(s.rWorkspace_ID)/prong/task/view/#(s.sID)" target="_blank">#(s.xName)</a></td>
                            <td>#(s.xLabel)</td>
                            <td>#(s.xPriority)</td>
                            <td>#date(s.sCreateDate, "yyyy-MM-dd")</td>
                            <td>#date(s.xFinishTime, "yyyy-MM-dd")</td>
                            <td>#number(s.xHour, "0.#")</td>
                        </tr>
                    #end
                </table>
            #end
        </div>

        
        <div style="width:100%;margin-left:auto;margin-right:auto;">
            #if(taskdata3??)
                <h3 style="text-align: left;">进行中</h3>
                <table class="gradienttable" border="1" style="width:100%;line-height:2em;">
                    <tr>
                        <th style="width:10em;">ID</th>
                        <th style="width:15em;">客户</th>
                        <th>任务</th>
                        <th style="width:10em;">标签</th>
                        <th style="width:10em;">优先级</th>
                        <th style="width:10em;">创建日期</th>
                        <th style="width:10em;">完成日期</th>
                        <th style="width:10em;">工时</th>
                    </tr>
                    #for(s:taskdata3)
                        <tr>
                            <td><a href="https://www.tapd.cn/#(s.rWorkspace_ID)/prong/task/view/#(s.sID)" target="_blank">#(s.xShortID)</a></td>
                            <td>#(s._Cust_Name)</td>
                            <td><a href="https://www.tapd.cn/#(s.rWorkspace_ID)/prong/task/view/#(s.sID)" target="_blank">#(s.xName)</a></td>
                            <td>#(s.xLabel)</td>
                            <td>#(s.xPriority)</td>
                            <td>#date(s.sCreateDate, "yyyy-MM-dd")</td>
                            <td>#date(s.xFinishTime, "yyyy-MM-dd")</td>
                            <td>#number(s.xHour, "0.#")</td>
                        </tr>
                    #end
                </table>
            #end
        </div>
   
    #end
    <div style="width:1366px;margin-left:auto;margin-right:auto;">
        <form action="/story/home" method="get" style="text-align:left;">
            <p>
                <label>
                    <input type="checkbox" name="xStatus1" value="1" #if(status1??) checked #end>未开始
                </label>
                <label>
                    <input type="checkbox" name="xStatus2" value="1" #if(status2??) checked #end>已完成
                </label>
                <label>
                    <input type="checkbox" name="xStatus3" value="1" #if(status3??) checked #end>进行中
                </label>
            </p>
            <p>
                <label for="mybegindate">开始日期:</label>
                <input type="date" id="mybegindate" name="begin" value="" required style="font-size:1.5em;">
                
                <label for="myenddate">结束日期日期:</label>
                <input type="date" id="myenddate" name="end" value="" required style="font-size:1.5em;">
            </p>
            <p style="text-align:right;">
                <button type="button" style="height:5em;width:7em;" onclick="doquery()">查询</button>&nbsp;
            </p>
        </form>
        
    </div>
    
    <script>
        // 设置日期输入框的默认值为当天日期
        document.getElementById('mybegindate').value = '#date(begin,"yyyy-MM-dd")';
        document.getElementById('myenddate').value = '#date(end,"yyyy-MM-dd")';
    </script>



</body>
</html>